package com.google.gwt.vector.client.ui;

import com.google.gwt.user.client.Element;
import com.google.gwt.vector.client.Vector;

/**
 *
 */
public class Rectangle extends BasicShape {

  private double x;
  private double y;

  private double width;
  private double height;

  private Rectangle(Element elem) {
    super(elem);
  }

  public Rectangle(double coordinateX, double coordinateY, double width,
      double height) {
    this(Vector.createRectangle());
    this.setCoord(coordinateX, coordinateY);
    this.setDimension(width, height);
    setColor(Color.BLACK);
    setStrokeColor(Color.BLACK);
    setStrokeWidth(1);
  }

  public void setCoord(double coordinateX, double coordinateY) {
    this.x = coordinateX;
    this.y = coordinateY;
    Vector.setCoord(getElement(), coordinateX, coordinateY, width, height);
  }

  public void setDimension(double width, double height) {
    this.width = width;
    this.height = height;
    Vector.setDimension(getElement(), width, height);
    setCoord(x, y);
  }
}
